package com.young.springdemo.service.visitorpattern;
//具体访问元素;HR只计算工时
public class HRDepartment  extends Department{

    @Override
    public void visit(FulltimeEmployee fulltimeEmployee) {
        double workHours = fulltimeEmployee.getWorkHours();
        //大于40属于加班时间,小于40属于请假时间
        if (workHours >40 ){
            System.out.println("正式 员工"+fulltimeEmployee.getName()+"加班"+(workHours-40)+"个小时");
        }else {
            System.out.println("正式 员工"+fulltimeEmployee.getName()+"请假"+(-workHours+40)+"个小时");
        }
    }

    @Override
    public void visit(ParttimeEmployee parttimeEmployee) {
        System.out.println("临时员工"+parttimeEmployee.getName()+"工作时长"+parttimeEmployee.getWorkHour()+"个小时");
    }
}
